#include <stdio.h>
int main()
{
	int m = 0, n = 0;
	printf("input m, n:");
	scanf("%d%d", &m, &n);
	int arr[m][n] = { 0 };
	int arr_num[m+n] = { 0 };
	int i = 0, j = 0, k = 0;
	printf("input array\n");
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf("%d", arr[i][j]);
		}
		getchar();
	}
	
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
			arr_num[k] += arr[i][j];
		k++;
	}
	
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
			arr_num[k] += arr[i][j];
		k++;
	}
	
	for (i = 0; i < m + n; i++)
		printf("sum of row %d is %d", i, arr_num[i]);
		
	return 0;
}